﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace graphicsdemo
{
    public class Rectangle:Graphics
    {
        private double width;
        private double height;

        public double Width { get => width; set => width = value; }
        public double Height { get => height; set => height = value; }

        public Rectangle(double width, double height)
        {
            Width = width;
            Height = height;
        }
        public override bool IfEffect()
        {
            if(Width <= 0 || Height <= 0)
                return false;
            else
                return true;
        }
        public override double GetArea()
        {
            if (IfEffect())
                return width * height;
            else
                return 0;
        }
        public override void Show()
        {
            Console.WriteLine("这个形状是长方形，面积为" + GetArea());
        }
    }
}
